<?php

/**
 * Students filter form base class.
 *
 * @package    polyannuaire
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseStudentsFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'year'          => new sfWidgetFormFilterInput(),
      'school_id'     => new sfWidgetFormPropelChoice(array('model' => 'School', 'add_empty' => true)),
      'first_name'    => new sfWidgetFormFilterInput(),
      'name'          => new sfWidgetFormFilterInput(),
      'company'       => new sfWidgetFormFilterInput(),
      'area_company'  => new sfWidgetFormFilterInput(),
      'pro_phone'     => new sfWidgetFormFilterInput(),
      'mobile_phone'  => new sfWidgetFormFilterInput(),
      'e_mail_pro'    => new sfWidgetFormFilterInput(),
      'service'       => new sfWidgetFormFilterInput(),
      'adress_pro1'   => new sfWidgetFormFilterInput(),
      'adress_pro2'   => new sfWidgetFormFilterInput(),
      'post_code'     => new sfWidgetFormFilterInput(),
      'position'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ville_pro'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'country'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'private_phone' => new sfWidgetFormFilterInput(),
      'private_mail'  => new sfWidgetFormFilterInput(),
      'updated_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'year'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'school_id'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'School', 'column' => 'id')),
      'first_name'    => new sfValidatorPass(array('required' => false)),
      'name'          => new sfValidatorPass(array('required' => false)),
      'company'       => new sfValidatorPass(array('required' => false)),
      'area_company'  => new sfValidatorPass(array('required' => false)),
      'pro_phone'     => new sfValidatorPass(array('required' => false)),
      'mobile_phone'  => new sfValidatorPass(array('required' => false)),
      'e_mail_pro'    => new sfValidatorPass(array('required' => false)),
      'service'       => new sfValidatorPass(array('required' => false)),
      'adress_pro1'   => new sfValidatorPass(array('required' => false)),
      'adress_pro2'   => new sfValidatorPass(array('required' => false)),
      'post_code'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'position'      => new sfValidatorPass(array('required' => false)),
      'description'   => new sfValidatorPass(array('required' => false)),
      'ville_pro'     => new sfValidatorPass(array('required' => false)),
      'country'       => new sfValidatorPass(array('required' => false)),
      'private_phone' => new sfValidatorPass(array('required' => false)),
      'private_mail'  => new sfValidatorPass(array('required' => false)),
      'updated_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('students_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Students';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'year'          => 'Number',
      'school_id'     => 'ForeignKey',
      'first_name'    => 'Text',
      'name'          => 'Text',
      'company'       => 'Text',
      'area_company'  => 'Text',
      'pro_phone'     => 'Text',
      'mobile_phone'  => 'Text',
      'e_mail_pro'    => 'Text',
      'service'       => 'Text',
      'adress_pro1'   => 'Text',
      'adress_pro2'   => 'Text',
      'post_code'     => 'Number',
      'position'      => 'Text',
      'description'   => 'Text',
      'ville_pro'     => 'Text',
      'country'       => 'Text',
      'private_phone' => 'Text',
      'private_mail'  => 'Text',
      'updated_at'    => 'Date',
    );
  }
}
